﻿namespace CSharpPro._0925;

public class Demo
{
    //练习
    public void TestPrint()
    {
        Random random = new Random();
        int num = random.Next(100,999);
        Console.WriteLine(num);
        //百
        Console.WriteLine(num/100);
        //十
        Console.WriteLine(num/10%10);
        Console.WriteLine(num%100/10);
        //个
        Console.WriteLine(num%10);
        
    } 
    
    
    
    
    
    
    //作业1 判断一个年份是不是闰年
    public void TestPrint1()
    {
        Console.WriteLine("请输入需要判断的年份");
        string inputStr = Console.ReadLine();
        if (!int.TryParse(inputStr, out int year))
        {
            Console.WriteLine("输入错误！请输入合法的整数年份（如2025）。");
            return;
        }

        bool isLeap = year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
        Console.WriteLine($"{year}年{(isLeap?"是":"不是")}闰年");
    } 
    
    
    
    
    
    
    //作业2
    public void TestPrint2(){
        
    }
}